/* 全局样式重置 */
:root {
    --primary-color: #4CAF50;
    --text-color: #333333;
    --background-color: #F5E6CA;
    --white: #FFFFFF;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --navbar-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Noto Sans SC', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--background-color);
    color: var(--text-color);
}

/* 游戏容器样式 */
#game-container {
    position: relative;
    width: 100vw;
    height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game {
    position: relative;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Canvas样式 */
canvas {
    display: block;
    margin: 0 auto;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -moz-osx-font-smoothing: grayscale;
}

/* 导航栏样式 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background-color: var(--primary-color);
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.navbar-brand {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.navbar-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 汉堡菜单样式 */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--white);
    transition: all var(--transition-speed);
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow: auto;
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 25px;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: modalFadeIn var(--transition-speed);
}

.instruction-content {
    text-align: left;
}

.instruction-content h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.instruction-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.key-instructions {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: 15px 0;
}

.key-instructions p {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: var(--white);
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.icon {
    font-size: 1.2rem;
    margin-right: 10px;
}

/* 结果窗口样式 */
.result-content {
    max-width: 600px !important;
    padding: 30px !important;
}

.result-container {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 12px;
}

.result-section {
    margin: 20px 0;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.result-section .icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.result-section #resultText {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.advice-text {
    color: #2c3e50;
    line-height: 1.6;
}

.tips-text {
    color: #666;
    line-height: 1.6;
}

.tips-text p {
    margin: 8px 0;
}

.button-container {
    margin-top: 25px;
    text-align: center;
}

.result-content h3 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

/* 按钮样式 */
.custom-button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    display: block;
}

.custom-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

/* 关闭按钮 */
.close-button {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    color: #aaa;
    cursor: pointer;
    transition: color var(--transition-speed);
}

.close-button:hover {
    color: var(--text-color);
}

/* 底部栏样式 */
.footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 0;
    text-align: center;
    font-size: 0.9rem;
    z-index: 1000;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-links {
    margin-top: 5px;
}

.footer a {
    color: var(--white);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer a:hover {
    color: #e0e0e0;
}

.separator {
    margin: 0 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* 动画 */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-links {
        display: none;
        position: fixed;
        top: var(--navbar-height);
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        flex-direction: column;
        padding: 10px 0;
        gap: 0;
    }

    .navbar-links.active {
        display: flex;
    }

    .nav-link {
        padding: 15px 20px;
        width: 100%;
        text-align: center;
        border-radius: 0;
    }

    .hamburger {
        display: flex;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }

    .instruction-content h3 {
        font-size: 1.3rem;
    }

    .instruction-text {
        font-size: 0.95rem;
    }

    .key-instructions {
        padding: 12px;
    }

    .custom-button {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .footer {
        padding: 8px 0;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1.2rem;
    }

    .modal-content {
        margin: 15% auto;
        padding: 15px;
    }

    .instruction-content h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .instruction-text {
        font-size: 0.9rem;
    }

    .key-instructions {
        padding: 10px;
    }

    .key {
        width: 25px;
        height: 25px;
    }

    .custom-button {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

/* 横屏模式优化 */
@media (max-height: 480px) and (orientation: landscape) {
    .navbar {
        height: 40px;
    }

    #game-container {
        height: calc(100vh - 40px);
        margin-top: 40px;
    }

    .modal-content {
        margin: 5% auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .instruction-text {
        font-size: 0.9rem;
    }

    .key-instructions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
